sub save_chart
{
        my $chart = shift or die "Need a chart!";
        my $name = shift or die "Need a name!";
 
        #my $ext = $chart->export_format;
 
        open(my $out, '>', "$name.png") or
                die "Cannot open '$name.png' for write: $!";
        binmode $out;
        print $out $chart->gd->png();
        close $out;
}
 
1;
